package com.util;

import java.util.HashMap;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class Util {
    public static Map jsonMap(String url) {
        url = "&" + url + "&";
        String reqKey = "&(.*?)=";
        Pattern patternKey = Pattern.compile(reqKey);
        Matcher matcherKey = patternKey.matcher(url);
        String reqValue = "((?<==).*?(?=&))";
        Pattern patternValue = Pattern.compile(reqValue);
        Matcher matcherValue = patternValue.matcher(url);
        Map<Object, Object> map = new HashMap<>();
        while (matcherKey.find()) {
            if (matcherValue.find()) {
                map.put(matcherKey.group(1), matcherValue.group(1));
            }
        }


        return map;
    }
}